package com.csnf.hymall.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public interface BaseMapper {
    /**
     * 查询总数
     * @param sql
     * @param obj
     * @return
     */
    public Integer getTotalCount(String sql,Object... obj) throws SQLException;

    /**
     * 添加
     * @param sql
     * @param params
     * @return
     */
    public Integer add(String sql,Object... params) throws SQLException;
    /**
     * 修改
     * @param sql
     * @param params
     * @return
     */
    public Integer update(String sql,Object... params) throws SQLException;
    /**
     * 删除
     * @param sql
     * @param params
     * @return
     */
    public Integer delete(String sql,Object... params) throws SQLException;
    /**
     * 查询单个对象
     * @param sql
     * @param tClass
     * @param params
     * @return
     */
    public <T>T get(String sql,Class<T> tClass,Object... params) throws  Exception;
    /**
     * 查询对象列表
     * @param sql
     * @param tClass
     * @param params
     * @return
     */
    public <T> List<T> getList(String sql,Class<T> tClass,Object... params) throws Exception;
    /**
     * 查询单个map
     * @param sql
     * @param params
     * @return
     */
    public Map<String,Object> queryMap(String sql,Object... params) throws SQLException;
    /**
     * 查询map列表
     * @param sql
     * @param params
     * @return
     */
    public List<Map<String,Object>> queryList(String sql,Object... params) throws SQLException;
}
